package com.wsp.controllermanagement.Util;

import org.springframework.security.crypto.bcrypt.BCrypt;

/**
 * Package: com.wsp.controllermanagement.Util
 * Description： TODO
 *
 * @Author: 巫思平
 * Copyright: Copyright (c) 2020
 * Version: 1
 */
public final class BcrypUtil {
    /**
     * 加密
     * @param password
     * @return
     */
    public static String encode(String password){
        return BCrypt.hashpw(password, BCrypt.gensalt());
    }

    /**
     * 密码校验
     * @param password
     * @param encodePassword
     * @return
     */
    public static boolean match(String password, String encodePassword){
        return BCrypt.checkpw(password, encodePassword);
    }
}
